package cn.com.nr.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;

import cn.com.common.result.DataResult;
import cn.com.nr.entity.NrCamonlinetimeEntity;
import cn.com.nr.service.NrCamonlinetimeService;



/**
 * 摄像头在线时间
 *
 * @author shaochangyang
 * @email l2l84o7o5@live.com
 * @date 2025-04-02 16:50:10
 */
@Controller
@RequestMapping("/")
public class NrCamonlinetimeController {
    @Autowired
    private NrCamonlinetimeService nrCamonlinetimeService;

    @ApiOperation(value = "新增")
    @PostMapping("/add")
    @ResponseBody
    public DataResult add(@RequestBody NrCamonlinetimeEntity nrCamonlinetime02502){
        nrCamonlinetimeService.save(nrCamonlinetime02502);
        return DataResult.success();
    }

    @ApiOperation(value = "删除")
    @DeleteMapping("/delete")
    @ResponseBody
    public DataResult delete(@RequestBody @ApiParam(value = "id集合") List<String> ids){
    	nrCamonlinetimeService.removeByIds(ids);
        return DataResult.success();
    }

    @ApiOperation(value = "更新")
    @PutMapping("/update")
    @ResponseBody
    public DataResult update(@RequestBody NrCamonlinetimeEntity nrCamonlinetime02502){
    	nrCamonlinetimeService.updateById(nrCamonlinetime02502);
        return DataResult.success();
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
	@ApiOperation(value = "查询分页数据")
    @PostMapping("/listByPage")
    @ResponseBody
    public DataResult findListByPage(@RequestBody NrCamonlinetimeEntity nrCamonlinetime02502){
        Page page = new Page(nrCamonlinetime02502.getPage(), nrCamonlinetime02502.getLimit());
        LambdaQueryWrapper<NrCamonlinetimeEntity> queryWrapper = Wrappers.lambdaQuery();
        //查询条件示例
        //queryWrapper.eq(NrCamonlinetime02502Entity::getId, nrCamonlinetime02502.getId());
        IPage<NrCamonlinetimeEntity> iPage = nrCamonlinetimeService.page(page, queryWrapper);
        return DataResult.success(iPage);
    }

}
